Added missing end and removed returns