refactored general design