Clean up and simplify code a bit further.