refactoring and code modernization

I've edited the code a little to be more up to date and strait foreword. The edge insets work a little differently now.