refactorings and excess code deletion