Working on a rewrite.

Signed-off-by: netchip <w00tc0d3@outlook.com>