fix borders, refactor code