add math and move stream into io