basic function completed, need someone to debug