First real tests and reorganizing some code