functional main added