Trimmed down some code.