implemented pagination. fixes #4
cleaned up things a bit
more cleanup and stuff...