Fixed code according to elvis advices