fixed delete function, some style changes