Initial commit of semi-working code