reorganized the entire code base, much cleaner now