Serial library overhaul

Now with platform abstraction!