added spinner and some bug fixes