Major revisions and optomizations