merged functions/code cleaning