added installer and did a bit of refactoring.