Major changes to add more functionality and stability