Separated common code between levels (if needs more than one) and fix performance trouble