made some optimizes