Finshing up ticket #5, fixes #5