Added modularity, sample input etc. Pre-final.