Refactor structure...repaired tests to work...