fixes and closes #61, added some fixes, added caching