changed comments and function order