simplyfy the code