extracted methods to simplify code