Fixed a bunch of queries, templates. Added datepicker.