Refactored PBS file generator. Added unit tests