added some code to support lcd output