little bit refactory on code for work with different heads