polished init and added more functions