Changed the way states change, when init is called and made updating a bit more efficient.