changed functions declaration order
removed unused functions