remove un-used function, popup temorarily for errors, add error checking