Cleaned up a bit

Functions are dark magic...