Completed problems 1 and 2, need to add some tests. Added common subroutines to module.