Initial draft of assignment solution

Full outline and completed comments, needs debug.