Initial commit of functional code