Redone engineering and bug fixes