breaking apart files from __init__. Fixed bug on querying by date. Added some tests.