a big refactoring done!