refactored stuff