remove code duplication in User class
minor coding style fix: use self instead of class name wherever possible