refactored w_* solutions after Pavel's comments