More elegant code