Adding most of the code. Been bad about commits lately.