more work on parsing of input, logic needs work. More thought required