Added Main environment class and main function