diff --git a/Text/JSON/JPath.hs b/Text/JSON/JPath.hs
--- a/Text/JSON/JPath.hs
+++ b/Text/JSON/JPath.hs
@@ -1,7 +1,9 @@
+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
+
 {- | I wanted to insert a description here, but got tired fighting with haddock escaping. Documentation: <http://bitcheese.net/wiki/code/hjpath>
 -}
 
-module Text.JSON.JPath (jPath, jPath', jPathModify, jPathModify') where
+module Text.JSON.JPath (jPath, jPathModify, Json(..), QueryElement(..), HJsonLike, QueryLike) where
 
 import qualified Data.Map as Map
 import Data.List
@@ -11,36 +13,64 @@
 import Text.ParserCombinators.Parsec.Char
 import Text.ParserCombinators.Parsec.Prim
 
-data Element = ObjectLookup String | ArrayLookup Integer | WildcardLookup | DeepLookup deriving (Show)
+-- | JPath query building blocks
+data QueryElement
+	-- | Look up element in object
+	= ObjectLookup String
+	-- | Look up array element (from 0 forward or from -1 backward)
+	| ArrayLookup Integer
+	-- | Matches any child element (array or hash entries)
+	| WildcardLookup
+	-- | Matches any number of child entries
+	| DeepLookup
+		deriving (Show)
 
--- |Evaluates JPath query on JSON String
-jPath :: String -- ^ JPath query
-	-> String 	-- ^ JSON as String
-	-> Either String [Json] -- ^ (Left parsing error) or (Right results)
-jPath query s = let json = JSON.fromString s
-	in either (Left) (Right . jPath' query) json
+-- | Class that allows type to be used as JPath query
+class QueryLike a where
+	toQuery :: a -> [QueryElement]
 
--- |Evaluates JPath query on pre-parsed JSON
-jPath' :: String  -- ^ JPath query
-	-> Json -- ^ Parsed JSON
-	-> [Json] -- ^ List of results
-jPath' query v = let parsedQuery = parseExpression query
-	in either (const []) (\q -> jPathP q v) parsedQuery
+instance QueryLike String where
+	toQuery = either (const []) (id) . parseExpression
 
--- |Modifies JSON content under JPath expression
-jPathModify :: String -- ^ JPath query
-	-> (Json -> Json) -- ^ Element modifier function
-	-> String -- ^ JSON as string
-	-> Either String String -- ^ (Left parsing error) or (Right modified JSON as string)
-jPathModify query modifier json = either (Left) (Right . JSON.toString . jPathModify' query modifier) $ JSON.fromString json
+instance QueryLike QueryElement where
+	toQuery e = [e]
 
--- |jPathModify for pre-parsed JSON
-jPathModify' :: String -- ^ JPath query
-	-> (Json -> Json) -- ^ Element modifier function
-	-> Json -- ^ JSON
-	-> Json -- ^ modified JSON
-jPathModify' query modifier json = either (const json) (\q -> (jPathModifyP q modifier json)) $ parseExpression query
+instance QueryLike [QueryElement] where
+	toQuery = id
 
+-- | Class that allows type to be used as JSON, all you need to implement is converting to and from Text.HJson.Json
+class HJsonLike a where
+	toHJson :: a -> Json
+	fromHJson :: Json -> a
+
+instance HJsonLike String where
+	toHJson = either (const JNull) (id) . JSON.fromString
+	fromHJson = JSON.toString
+
+instance HJsonLike Json where
+	toHJson = id
+	fromHJson = id
+
+-- | Evaluates JPath query on JSON String
+jPath :: (HJsonLike j, QueryLike q) =>
+	q -- ^ JPath query
+	-> j 	-- ^ JSON 
+	-> [j] -- ^ Results
+jPath q j = 
+	let json = toHJson j;
+		query = toQuery q
+		in map (fromHJson) $ jPathP query json
+
+-- | Modifies JSON content under JPath expression
+jPathModify :: (HJsonLike j, QueryLike q) =>	q -- ^ JPath query
+	-> (Json -> Json) -- ^ modifier function
+	-> j -- ^ JSON
+	-> j -- ^ Modified JSON
+jPathModify q modifier j = 
+	let json = toHJson j;
+		query = toQuery q
+		in fromHJson $ jPathModifyP query modifier json
+
 -- private functions
 
 expression = do
@@ -50,7 +80,7 @@
 
 slash = string "/"
 
-element :: GenParser Char st [Element]
+element :: GenParser Char st [QueryElement]
 element = do
 	parsedName <- optionMaybe (deepLookup <|> wildcard <|> name)
 	parsedIndex <- optionMaybe index
@@ -79,7 +109,7 @@
 
 parseExpression = parse expression "JPath query"
 
-jPathP :: [Element] -> Json -> [Json]
+jPathP :: [QueryElement] -> Json -> [Json]
 jPathP [] v = [v]
 jPathP (e:es) v = case e of
 	ObjectLookup s -> case v of
@@ -97,7 +127,7 @@
 		otherwise -> []
 	DeepLookup -> concat [jPathP (WildcardLookup:es) v, jPathP ([WildcardLookup, DeepLookup] ++ es) v]
 
-jPathModifyP :: [Element] -> (Json -> Json) -> Json -> Json
+jPathModifyP :: [QueryElement] -> (Json -> Json) -> Json -> Json
 jPathModifyP [] modifier v = modifier v
 jPathModifyP (e:es) modifier v = let traverse = jPathModifyP es modifier in case e of
 	ObjectLookup s -> case v of
diff --git a/hjpath.cabal b/hjpath.cabal
--- a/hjpath.cabal
+++ b/hjpath.cabal
@@ -1,5 +1,5 @@
 Name: hjpath
-Version: 2.0
+Version: 3.0
 Synopsis: XPath-like syntax for querying JSON
 Category: Text
 Description: JPath is XPath-inspired query language to query JSON data.
@@ -17,4 +17,4 @@
 
 library
  Exposed-Modules: Text.JSON.JPath
- Build-Depends: base >= 4 && < 5, hjson, parsec >= 2.1, containers
+ Build-Depends: base >= 4 && < 5, hjson, parsec >= 3.0.0, containers
