code cleanup

@jianglin612 Cleans up unused methods and stuff, just double check it and merge it in