More Code

Implemented what we discussed. It needs to be tested, but the basic
logic should be there