Cleaned and Updated Code

Basic code update from static. Corrected Indention. And made core more efficent.