cleaned up, got the value handling right