major refactor and added transitions functionality