Factored some inline code out.