fixed vars, refactored