Some improvement in code