Fix tests and restructure project