Cleaned up repetitive code