checksuccess as own function
improved speed for big pages using multipart/form-data
removed duplicated code