Added Tests. Fixed Online