Main function in place