Modified main functions