optimize code + make methods private