Initial commit of bulk of the implementation