Added Interfaces, implemented factory and state patterns.