organized the code a bit. added few tests