First attempt, still many bugs and problems to find and fix.