Added some complex behavior. Started writing some integration tests