Cleaned up the code

Added routines for setting up borders