Refactor, fix uppercase lowercase problem