First commit

Looks like cost function works. The output might not be correct still.