New simple version, cleaned up the code a little...