functional but fixing bugs