Added GET functionality, fixes #78.
Some extra refactoring too.