properly return a value from non-void function