Fixed issues #1 and #2; started to add some tests