split some functions so that they can refresh independently
debugged error in testing
Merge pull request #32 from usgin/refresh

Refresh fixes #24