Fixed code repetition