Fixed many bugs and inefficient design, thank Danial Hartwig <mandyke@gmail.com> !