Heavy refactroing and restructuring

Refs #6