made code neater