remove unused code and fixed some style