cleanup app code

make some improvments