quickly improve somes part of code