more specific search when looking for records related to a system
pep8
added a test case
fixed dumb datetime stftime bug.

Also, I removed a bunch of dumplicate code? Not sure how it got there. A code review would have caught it.