Almost finished, just need stdin functionality.