added color saving + refactoring