arrange the code better