Implemented most of phase 1 proof of concept