clean up variable declaration and conditional