Initial commit of semi-working version