reworked depost function and dried up code a bit