simplified the code.