split up js code and made some changes to the blur code