postback handling refactored