Added main subroutine