Polish and some bug fixes