Added unit tests and altered some syntax