code clean up && small fixes