implemented all math except factor