Applied best practices (copied from SVN repository)