Cleaner code with typdefs

Added typedefs, rearranged things, created easymath, made things private