Completed with thickness feature
** Cleaned a lot of code, moved ugly code to seperate funtions